﻿@model IEnumerable<KRM.Core.KRMSTKSP_GetPartsNew2_Result>
@{
    Layout = null;
}
<table class="table table-bordered table-fix tbl-selected krmtable" data-height="400">
    <thead>
        <tr>
            <th>Img</th>
            <th>PartID</th>
            <th>PartName</th>
            <th>GroupName</th>
            <th>PartCode</th>
            <th>StockLevel</th>
            <th>Allocated</th>
            <th>PickedNotLoaded</th>
            <th>TotalStock</th>
            <th>ReorderLevel</th>
            <th>CompanyName</th>
            <th>CompanyId</th>
            <th>SupplierLeadtime</th>
            <th>StockValue</th>
            <th>Sutton</th>
            <th>Tuxford</th>
            <th>Drayton</th>
            <th>NumberSold</th>
            <th>DaysOfStock</th>
            <th>CustomersWaiting</th>
            <th>StockArrivalDates</th>
            <th>IsOnSite</th>
        </tr>
    </thead>
    <tbody>

        @foreach (var item in Model)
        {
            string img = "";
            switch (item.StockStatus())
            {
                case 0: img = "Stockout-warn.png"; break;
                case 1: img = "Stockout.png"; break;
                case 2: img = "Stockok-warn.png"; break;
                case 3: img = "Stockout-warn.png"; break;
                case 4: img = "Stockok.png"; break;
                case 5: img = "Stockok-more.png"; break;
                case 6: img = "Stockhealthy-warn.png"; break;
                case 7: img = "Stockhealthy.png"; break;
                case 8: img = "Stockhealthy-more.png"; break;
                case 9: img = "urgent.png"; break;
                case 10: img = "Stockok.png"; break;
            }
            <tr title="@item.TtStock()" onclick="partitemselected(@item.PartID)" >
                <td style="text-align: center">
                    <img src="/img/stockimg/@img" style="max-width: 22px;"/>
                </td>
                <td>@item.PartID</td>
                <td style="color: @item.TextColour().Name">@item.PartName</td>
                <td>@item.GroupName</td>
                <td>@item.PartCode</td>
                <td>@item.StockLevel</td>
                <td>@item.Allocated</td>
                <td>@item.PickedNotLoaded</td>
                <td>@item.TotalStock</td>
                <td>@item.ReorderLevel</td>
                <td>@item.CompanyName</td>
                <td>@item.CompanyId</td>
                <td>@item.SupplierLeadtime</td>
                <td>@item.StockValue</td>
                <td>@item.Sutton</td>
                <td>@item.Tuxford</td>
                <td>@item.Drayton</td>
                <td>@item.NumberSold</td>
                <td>@item.DaysOfStock</td>
                <td>@item.CustomersWaiting</td>
                <td>@item.StockArrivalDates</td>
                <td>@item.IsOnSite</td>
            </tr>
        }
    </tbody>
</table>
